-- msg_leave_room
-- Create by weism
-- 通知玩家离开房间

return function(lpc)
    local rid = lpc.rid;
    local user = RID.find(rid);
    if (user == nil) then
        trace("msg_leave_room", "玩家不存在");
        return;
    end 
    
    -- 删除房间字段
    user.dbase:delete("room");
    if (rid == ME.user.rid) then
        ME.leaveRoom();
        return;
    end
    
    -- 其他人离开房间
    trace("msg_leave_room", "%s离开了当前房间", user.dbase:query("name", ""));
end
